package com.esri.core.symbol.advanced;

import com.esri.core.internal.util.d;
import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class Message {
    private static final String a = "_id";
    private Map<String, Object> b;

    /* loaded from: classes.dex */
    private class a implements Comparator<String> {
        private a() {
        }

        @Override // java.util.Comparator
        /* renamed from: a */
        public int compare(String str, String str2) {
            return str.toLowerCase().compareTo(str2.toLowerCase());
        }
    }

    public Message() {
        this.b = new TreeMap(new a());
    }

    public Message(JsonParser jsonParser) {
        this.b = new TreeMap(new a());
        try {
            if (d.c(jsonParser)) {
                while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                    String currentName = jsonParser.getCurrentName();
                    jsonParser.nextToken();
                    if (a.equalsIgnoreCase(currentName)) {
                        setID(jsonParser.getText());
                    } else {
                        setProperty(currentName, jsonParser.getText());
                    }
                }
            }
        } catch (JsonParseException e) {
            e.printStackTrace();
        } catch (IOException e2) {
            e2.printStackTrace();
        } catch (Exception e3) {
            e3.printStackTrace();
        }
    }

    public Message(Message message) {
        this.b = new TreeMap(new a());
        this.b = new TreeMap(message.b);
    }

    public String getID() {
        Object obj = this.b.get(a);
        if (obj != null) {
            return obj.toString();
        }
        return null;
    }

    public void setID(String str) {
        this.b.put(a, str);
    }

    public Map<String, Object> getProperties() {
        return Collections.unmodifiableMap(this.b);
    }

    public void setProperties(Map<String, Object> map) {
        this.b.clear();
        this.b.putAll(map);
    }

    public void addProperties(Map<String, Object> map) {
        this.b.putAll(map);
    }

    public Object getProperty(String str) {
        return this.b.get(str);
    }

    public void setProperty(String str, Object obj) {
        this.b.put(str, obj);
    }

    public String toString() {
        return "Message [mID=" + this.b.get(a) + ", mProperties=" + this.b + "]";
    }
}
